package com.xps.charmingshop.date.net;


import com.xps.charmingshop.bean.ClassificationBean;
import com.xps.charmingshop.bean.ConductBean;
import com.xps.charmingshop.bean.LoginBean;
import com.xps.charmingshop.bean.RegisterBean;
import com.xps.charmingshop.bean.ShopBean;
import com.xps.charmingshop.bean.VerificationBean;
import com.xps.charmingshop.date.servicrapi.UserApi;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class UserNetWorks extends RetrofitUtils {

    protected static final UserApi userApi = RetrofitUtils.getUserApi();

    //注册接口
    public static void getRegister(String shop_register_way, String shop_avatar, String shop_email, String shop_name, String shop_sort_id, String shop_branch, String shop_main, String shop_pass1, String shop_pass2, String shop_tel, String sms_code, String shop_business_license, String shop_province, String shop_city, String shop_address, String shop_x, String shop_y, Subscriber<RegisterBean> observer) {
        userApi.getRegister(shop_register_way, shop_avatar, shop_email, shop_name, shop_sort_id, shop_branch, shop_main, shop_pass1, shop_pass2, shop_tel, sms_code, shop_business_license, shop_province, shop_city, shop_address, shop_x, shop_y).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //注册验证码接口
    public static void getVerification(String shop_register_way, Subscriber<VerificationBean> observer) {
        userApi.getVerification(shop_register_way).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //登录接口
    public static void getLogin(String shop_email, String shop_password, Subscriber<LoginBean> observer) {
        userApi.getLogin(shop_email, shop_password).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    //订单列表
    public static void getOrder(String shop_token, Subscriber<ConductBean> observer) {
        userApi.getOrder(shop_token).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取店铺信息
    public static void getShop(String shop_token, Subscriber<ShopBean> observer) {
        userApi.getShop(shop_token).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取店铺分类列表
    public static void getClassification(String shop_token, Subscriber<ClassificationBean> observer) {
        userApi.getClassification(shop_token).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }
}
